<template>
  <div class="container">
    <el-form ref="search" :inline="true" :model="form" class="search" label-width="100px" size="small">
      <el-form-item label="访客姓名">
        <el-input v-model="form.user" placeholder="请输入名称" />
      </el-form-item>
      <el-form-item label="访客手机号:">
        <el-input v-model="form.mobile" />
      </el-form-item>
      <el-form-item label="访客公司:">
        <el-input v-model="form.company" placeholder="请输入访客公司" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" size="mini" @click="onSubmit">查询</el-button>
        <el-button type="primary" size="mini" @click="handlePerson">人员轨迹</el-button>
      </el-form-item>
    </el-form>
    <div class="table-wrap">
      <div class="f-betweenX table-header">
        <div class="table-title">
          <svg-icon icon-class="table_menu" class-name="icon-table" />
          <!-- 查询结果 共找到 <span class="count">1006</span> 条符合的记录{{ maxTableHeight }} -->
          查询结果 共找到 <span class="count">4</span> 条符合的记录
        </div>
      </div>
      <!-- 表格 -->
      <el-table :data="tableData" stripe style="width: 100%" border>
        <el-table-column prop="name" label="访客姓名" sortable resizable show-overflow-tooltip align="center" />
        <el-table-column prop="avatar" label="访客照片" resizable show-overflow-tooltip align="center" />
        <el-table-column prop="mobile" label="访客手机号" resizable show-overflow-tooltip align="center" />
        <el-table-column prop="sex" label="访客性别" resizable show-overflow-tooltip align="center" />
        <el-table-column prop="company" label="访客公司" resizable show-overflow-tooltip align="center" />
        <el-table-column prop="id" label="访客身份证号" resizable show-overflow-tooltip align="center" />
        <el-table-column prop="remark" label="备注" resizable show-overflow-tooltip align="center" />
        <el-table-column fixed="right" label="操作" width="400" show-overflow-tooltip resizable align="center">
          <template slot-scope="scope">
            <el-button size="mini" type="danger" plain @click="handleDelete(scope.row)">
              删除
            </el-button>
            <el-button size="mini" type="warning" plain @click="handeleMove(scope.row)">
              转移
            </el-button>
            <el-button size="mini" type="primary" plain @click="handeleRecord(scope.row)">
              拜访记录
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页 -->
      <el-pagination :current-page="query.page" :page-sizes="query.pageSize" :page-size="query.size" layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 查询
      form: {
        user: '',
        mobile: '',
        company: ''
      },
      // 分页器
      query: {
        page: 1,
        size: 10,
        pageSize: [5, 10, 20]
      },
      total: 4,
      // 表格数据
      tableData: [
        {
          name: '张三',
          avatar: '',
          mobile: '13800000000',
          sex: '男',
          company: '甲',
          id: '140xxxxxxxxxxx',
          remark: '123'
        },
        {
          name: '李四',
          avatar: '',
          mobile: '13833333333',
          sex: '女',
          company: '甲',
          id: '140xxxxxxxxxxx',
          remark: '564'
        },
        {
          name: '王五',
          avatar: '',
          mobile: '13822222222',
          sex: '男',
          company: '甲',
          id: '140xxxxxxxxxxx',
          remark: '234'
        },
        {
          name: '赵六',
          avatar: '',
          mobile: '138111111111',
          sex: '女',
          company: '甲',
          id: '140xxxxxxxxxxx',
          remark: '123434'
        }
      ]
    }
  },
  methods: {
    // 查询
    onSubmit() {
      console.log('submit!')
    },
    // 人员轨迹
    handlePerson() {
      this.$router.push({ name: 'VisitorRoute' })
    },
    // 新增
    handleAdd() {

    },
    // 改变条数
    handleSizeChange() {

    },
    // 改变页码
    handleCurrentChange() {

    },
    // 转移
    handleMove() {

    },
    // 拜访记录
    handeleRecord() {
      this.$router.push({ name: 'VisitorRecord' })
    }

  }
}
</script>

<style lang="scss" scoped>
.container {
  padding: 0 17px;
  .search {
    padding-top: 16px;
  }
  .table-wrap {
    .icon-table {
      margin: 0 10px;
    }
    .table-header {
      height: 52px;
      background: #f6f7f9;
      border: 1px solid #e1e7e9;
      border-bottom: none;
      font-size: 16px;
      color: #494949;
      line-height: 52px;
      border-radius: 4px 4px 0 0;
      .count {
        color: rgb(235, 104, 84);
      }
      .table-control {
        margin-right: 10px;
      }
    }
  }
  .pagination-wrap {
    height: 80px;
    .pagination {
      display: inline-block;
    }
  }
}
</style>

<style lang="scss">
.tree-line {
  .el-tree-node {
    position: relative;
    padding-left: 16px; // 缩进量
  }
  .el-tree-node__children {
    padding-left: 16px; // 缩进量
  }

  // 竖线
  .el-tree-node::before {
    content: '';
    height: 100%;
    width: 1px;
    position: absolute;
    left: -3px;
    top: -26px;
    border-width: 1px;
    border-left: 1px dashed #52627c;
  }
  // 当前层最后一个节点的竖线高度固定
  .el-tree-node:last-child::before {
    height: 38px; // 可以自己调节到合适数值
  }

  // 横线
  .el-tree-node::after {
    content: '';
    width: 24px;
    height: 20px;
    position: absolute;
    left: -3px;
    top: 12px;
    border-width: 1px;
    border-top: 1px dashed #52627c;
  }

  // 去掉最顶层的虚线，放最下面样式才不会被上面的覆盖了
  & > .el-tree-node::after {
    border-top: none;
  }
  & > .el-tree-node::before {
    border-left: none;
  }

  // 展开关闭的icon
  .el-tree-node__expand-icon {
    font-size: 16px;
    // 叶子节点（无子节点）
    &.is-leaf {
      color: transparent;
      // display: none; // 也可以去掉
    }
  }
}
.el-pagination {
  margin-left: 40%;
  margin-top: 30px;
}
</style>
